package com.lishe.lishe.jiguang.service;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import com.lishe.lishe.lishe.module.main.http.HttpAppUpdata;
import com.lishe.lishe.lishe.utils.SharedPreferencesUtils;

import cn.jpush.android.api.JPushInterface;

/**
 * Created by shino on 2017/11/14.
 * <!--Required 用户注册SDK的intent-->
 * <action android:name="cn.jpush.android.intent.REGISTRATION" />
 * <!--Required 用户接收SDK消息的intent-->
 * <action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />
 * <!--Required 用户接收SDK通知栏信息的intent-->
 * <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />
 * <!--Required 用户打开自定义通知栏的intent-->
 * <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" />
 * <!-- 接收网络变化 连接/断开 since 1.6.3 -->
 * <action android:name="cn.jpush.android.intent.CONNECTION" />
 */

public class JiGuangNormalService extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        Bundle bundle=intent.getExtras();
        switch (action) {
            case JPushInterface.ACTION_REGISTRATION_ID:
                String regId1=bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
                Log.e("极光推送1  RegistrationID =", regId1);
                SharedPreferencesUtils.saveRegistrationID(regId1);
                break;
            case "cn.jpush.android.intent.MESSAGE_RECEIVED":
                Log.e("极光推送2", action);
                break;
            case "cn.jpush.android.intent.NOTIFICATION_RECEIVED":
                Log.e("极光推送3", action);
                break;
            case "cn.jpush.android.intent.NOTIFICATION_OPENED":
                Log.e("极光推送4", action);
                break;
            case "cn.jpush.android.intent.CONNECTION":
                Log.e("极光推送5", action);
                break;
        }
    }
}
